<?php extract($overallRank); ?>

<div id="content">
    <h2>My Groups</h2>
    <div class="searchForm">
        <?=form_open('/student/group_search');?>
        <?=form_input('searchTerm');?>
        <?=form_submit('', 'Search');?>
        <?=form_close();?>
    </div>
    <table class="groups">
        <tr><th>Group Name</th><th>Group Type</th><th>My Score</th><th>My Rank</th><th># of Students</th><th>Avg. Points</th></tr>
        <?php if (count($college) > 1): ?><tr>
            <td><a href="/student/group_details/college/<?=$college['college_id'];?>"><?=$college['college_name'];?></a></td>
            <td>College</td>
            <td><?=$user_score;?></td>
            <td><?=$college['rank'];?></td>
            <td><?=$college['count'];?></td>
            <td><?=round($college['average']);?></td>
        </tr><?php endif; ?>
        <?php if (count($school) > 1): ?><tr>
            <td><a href="/student/group_details/school/<?=$school['school_id'];?>"><?=$school['school_name'];?></a></td>
            <td>School</td>
            <td><?=$user_score;?></td>
            <td><?=$school['rank'];?></td>
            <td><?=$school['count'];?></td>
            <td><?=round($school['average']);?></td>
        </tr><?php endif; ?>
        <?php if (count($major) > 1): ?><tr>
            <td><a href="/student/group_details/major/<?=$major['major_id'];?>"><?=$major['major_name'];?></a></td>
            <td>Major</td>
            <td><?=$user_score;?></td>
            <td><?=$major['rank'];?></td>
            <td><?=$major['count'];?></td>
            <td><?=round($major['average']);?></td>
        </tr><?php endif; ?>
        <?php if (count($minor) > 1): ?><tr>
            <td><a href="/student/group_details/minor/<?=$minor['minor_id'];?>"><?=$minor['minor_name'];?></a></td>
            <td>Minor</td>
            <td><?=$user_score;?></td>
            <td><?=$minor['rank'];?></td>
            <td><?=$minor['count'];?></td>
            <td><?=round($minor['average']);?></td>
        </tr><?php endif; ?>
<tr><td class="divider" colspan="6">&nbsp;</td></tr>
        <?php if (isset($groupRank)): ?>
                <?php foreach ($groupRank as $group): ?><tr>
                    <td><a href="/student/group_details/group/<?=$group['group_id'];?>"><?=ucwords($group['group_name']);?></a></td>
                    <td><?=$group['group_type'];?></td>                    
                    <td><?=$group['score'];?></td>
                    <td><?=$group['rank'];?></td>
                    <td><?=$group['count'];?></td>
                    <td><?=round($group['average']);?></td>
                </tr><?php endforeach; ?>
        <?php endif; ?>
    </table>
</div> <!-- #content -->